<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定时跳转</title>
    <style>
        body {
            background: gray;
        }
        
        div {
            float: left;
            width: 400px;
            height: 150px;
            margin-left: 30%;
            border: 1px solid black;
            background: white;
        }
        
        h2 {
            text-align: center;
        }
        
        a {
            display: block;
            text-align: center;
        }
        
        span {
            color: red;
            font-size: 20px;
        }
    </style>

</head>

<body>
    <div>
        <h2>提交成功</h2>
        <a href="www.example.com"><span id="seconds">3</span>&nbsp;秒后系统会自动跳转，也可单击此链接跳转</a>
    </div>

    <script>
        function timing(secs, url) {
            var seconds = document.getElementById('seconds')
            seconds.innerHTML = secs
            if (--secs > 0) {
                setTimeout('timing(' + secs + ',\'' + url + '\')', 1000)
            } else {
                location.href = url
            }
        }

        timing(3, "www.example.com")
    </script>
</body>

</html>